home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / FLI106C.ZIP;1 / WINVIR.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-12  |  3.3 KB  |  150 lines

  1. //
  2. // The Fusion Library Interface for DOS
  3. // Version 1.06c
  4. // Copyright (C) 1990, 1991, 1992
  5. // Software Dimensions
  6. //
  7. // FusionWindow
  8. //
  9.  
  10. #include "fliwin.h"
  11. #include "colors.h"
  12.  
  13. #ifdef __BCPLUSPLUS__
  14. #pragma hdrstop
  15. #endif
  16.  
  17. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  18. //
  19. // VirtualInterval()
  20. //
  21. // Interval between automated refreshment
  22. //
  23. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  24.  
  25. void FusionWindow::VirtualInterval(int _Interval)
  26. {
  27.   VirtualizeInterval=_Interval;
  28. }
  29.  
  30. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  31. //
  32. // VirtualizeFresh()
  33. //
  34. // Refreshes all of the virtual windows
  35. //
  36. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  37.  
  38. void FusionWindow::VirtualizeFresh()
  39. {
  40.   if (!NumberOfWindows)
  41.     return;
  42.  
  43.   for (register int i=NumberOfWindows-1,j=0;i>=0;i--)
  44.     if (Windows[i]->VirtualUpdate)
  45.       j++;
  46.  
  47.   if (!j)
  48.     return;
  49.  
  50.   char *EntireWindow=
  51.     new char[Blaze.ComputeNeededBytes(Blaze.WhatWidth(),Blaze.WhatHeight())];
  52.  
  53.   Blaze.UseMemory(EntireWindow);
  54.   Blaze.CharacterFill(0,1,Blaze.WhatWidth(),Blaze.WhatHeight()-2,
  55.     Colors.WorkSpace,176);
  56.  
  57.   for (i=NumberOfWindows-1;i>=0;i--)
  58.   {
  59.     Windows[i]->Blaze.UseMemory(EntireWindow);
  60.     Windows[i]->ShowWindow();
  61.     Windows[i]->ShowInterior();
  62.     if (Windows[i]->VirtualUpdate)
  63.       Windows[i]->EventHandler(VirtualEvent);
  64.     Windows[i]->Blaze.UseVideo();
  65.   }
  66.  
  67.   MouseHide();
  68.  
  69.   if (CurrentLevel)
  70.   {
  71.     for (int i=0;i<CurrentLevel;i++)
  72.     {
  73.       MenuItems &Menu=*SubMenuTrack[i];
  74.  
  75.       if (FusionShadowing)
  76.       {
  77.         int XShadow=1;
  78.         int YShadow=1;
  79.  
  80.         if (Menu.X+Menu.Width==Blaze.WhatWidth())
  81.           XShadow=0;
  82.  
  83.         if (Menu.Y+Menu.Width==Blaze.WhatHeight()-2)
  84.           YShadow=0;
  85.  
  86.         Blaze.Shadow(Menu.X+XShadow,Menu.Y+YShadow,Menu.Width,Menu.Height);
  87.       }
  88.  
  89.       Blaze.BlockCopyVisualToVirtual(Menu.X,Menu.Y,Menu.Width,
  90.         Menu.Height,EntireWindow);
  91.     }
  92.   }
  93.   else if (NumberOfWindows && Windows[0]->CurrentLevel)
  94.   {
  95.     for (int i=0;i<Windows[0]->CurrentLevel;i++)
  96.     {
  97.       MenuItems &Menu=*Windows[0]->SubMenuTrack[i];
  98.  
  99.       if (FusionShadowing)
  100.       {
  101.         int XShadow=1;
  102.         int YShadow=1;
  103.  
  104.         if (Menu.X+Menu.Width==Blaze.WhatWidth())
  105.           XShadow=0;
  106.  
  107.         if (Menu.Y+Menu.Width==Blaze.WhatHeight()-2)
  108.           YShadow=0;
  109.  
  110.         Blaze.Shadow(Menu.X+XShadow,Menu.Y+YShadow,Menu.Width,Menu.Height);
  111.       }
  112.  
  113.       Blaze.BlockCopyVisualToVirtual(Menu.X,Menu.Y,Menu.Width,
  114.         Menu.Height,EntireWindow);
  115.     }
  116.   }
  117.  
  118.   Blaze.BlockCopyVirtualToVisual(0,1,Blaze.WhatWidth(),Blaze.WhatHeight()-2,
  119.     EntireWindow);
  120.  
  121.   MouseShow();
  122.  
  123.   Blaze.UseVideo();
  124.  
  125.   delete EntireWindow;
  126.  
  127.   Windows[0]->Cursor();
  128. }
  129.  
  130. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131. //
  132. // CheckVirtuals()
  133. //
  134. // Checks for virual presence
  135. //
  136. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  137.  
  138. int FusionWindow::CheckVirtuals()
  139. {
  140.   if (!NumberOfWindows)
  141.     return 0;
  142.  
  143.   for (register int i=NumberOfWindows-1,j=0;i>=0;i--)
  144.     if (Windows[i]->VirtualUpdate)
  145.       j++;
  146.  
  147.   return j;
  148. }
  149.  
  150.